var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var KanbanIndex = (function (_super) {
    __extends(KanbanIndex, _super);
    function KanbanIndex() {
        _super.apply(this, arguments);

    }
    KanbanIndex.prototype.Ready = function () {
        var mainDiv = $("#selected, #unselected");
        mainDiv.sortable({
            connectWith: ".connectedSortable",
            dropOnEmpty: true,
            receive: this.SortableReceiveItem
        }).disableSelection();
        mainDiv.find("li").each(function () {
            var _this = this;
            $(this).dblclick(function () {
                var actorPart = (($(_this).parent())[0].id == "selected") ? 1 : 0;
                return Base.Page.Self.ReceiveItem(_this, actorPart, function () {
                    $(_this).remove();
                    $((actorPart == 0) ? "#selected" : "#unselected").append(_this);
                    mainDiv.sortable('refresh');
                });
            });
        });
    };
    KanbanIndex.prototype.SortableReceiveItem = function (event, ui) {
        var actorPart = -1;
        if(event.target.id == "selected") {
            actorPart = 0;
        } else if(event.target.id == "unselected") {
            actorPart = 1;
        } else {
            return false;
        }
        return (Base.Page.Self.ReceiveItem(ui.item[0], actorPart));
    };
    KanbanIndex.prototype.ReceiveItem = function (item, actorPart, callBack) {
        $.getJSON(Base.Page.Self.aUrl[0], {
            way: actorPart,
            id: item.id,
            projectId: $(item).attr('data-projectid')
        }, callBack && callBack());
    };
    return KanbanIndex;
})(Base.Page);
//@ sourceMappingURL=KanbanIndex.js.map
